package ua.kharkov.knure.dereza.summarytask4.db.dao;

import ua.kharkov.knure.dereza.summarytask4.db.dao.mysql.MysqlDAOFactory;

/**
 * Abstract class DAO Factory
 * 
 * @author dereza
 * 
 */
public abstract class DAOFactory {

	public static final int MYSQL = 1;

	// In future, if you want change sql server you will create new factory.
	// For example:
	// public static final int DERBY = 2;

	/**
	 * Abstract factory Method for ClientDAO.
	 * 
	 * @return ClientDAO
	 */
	public abstract ClientDAO getClientDAO();

	/**
	 * Abstract factory Method for CardDAO.
	 * 
	 * @return CardDAO
	 */
	public abstract CardDAO getCardDAO();

	/**
	 * Abstract factory Method for RoleDAO.
	 * 
	 * @return RoleDAO
	 */
	public abstract RoleDAO getRoleDAO();

	/**
	 * Abstract factory Method for StatusDAO.
	 * 
	 * @return StatusDAO
	 */
	public abstract StatusDAO getStatusDAO();

	/**
	 * Abstract factory Method for CurrencyDAO.
	 * 
	 * @return CurrencyDAO
	 */
	public abstract CurrencyDAO getCurrencyDAO();

	/**
	 * Abstract factory Method for LocaleDAO.
	 * 
	 * @return LocaleDAO
	 */
	public abstract LocaleDAO getLocaleDAO();

	/**
	 * Factory method allow gets necessary instance of DAOFactory.
	 */
	public static DAOFactory getDAOFactory(int whichFactory) {
		switch (whichFactory) {
		case MYSQL:
			return new MysqlDAOFactory();
		// It will be necessary if you change sql server.
		// case DERBY:
		// return new DerbyDAOFactory();
		default:
			return null;
		}
	}
}